//package com.bmf.admin.module.attribute.controller;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.nio.charset.StandardCharsets;
//import java.util.Arrays;
//
//@Slf4j
//@Component
//public class RedisMessageSubscriber implements MessageListener {
//
////    @Autowired
////    private RedisMessageListenerContainer redisMessageListenerContainer;
////
////    @Autowired
////    private RedisUtils redisUtils;
//
//    /**
//     * 订阅消息：将订阅者添加到指定的频道
//     */
//    @PostConstruct
//    public void subscribeToChannel() {
//        //广播消息
////        redisMessageListenerContainer.addMessageListener(this, new ChannelTopic(ChannelConstant.CHANNEL_GLOBAL_NAME));
////        redisMessageListenerContainer.addMessageListener(this, Arrays.asList(new ChannelTopic(ChannelConstant.CHANNEL_GLOBAL_NAME),new ChannelTopic(ChannelConstant.CHANNEL_SINGLE_NAME)));
//    }
//
//    @Override
//    public void onMessage(Message message, byte[] bytes) {
//        String channel = new String(message.getChannel(), StandardCharsets.UTF_8);
//        String messageBody = new String(message.getBody(), StandardCharsets.UTF_8);
//        log.info("收到消息: " + messageBody + " 在频道: " + channel);
////        String string = redisUtils.get("publish:msg");
////        log.info("查出缓存:"+string);
//    }
//}